#include "Seqlist.h"
//#include <assert.h>
void Seqnit(SL*p)
{
	p->arr = NULL;
	p->size = p->capacity = 0;
}
void Seqpushback(SL* p, SCLdata x)
{
	//assert(p!=NULL);
	//int newcapacity = p->capacity == 0 ? 4: p->capacity * 2;
	//p->capacity = newcapacity;
	if (p->size == p->capacity)
	{
		int newcapacity = p->capacity == 0 ? 4 : p->capacity * 2;
		p->capacity = newcapacity;
		SCLdata* temp = (SCLdata*)realloc(p->arr,newcapacity*sizeof(SCLdata));
		if (temp == NULL)
		{
			perror("realloc");
			exit(1);
		}
		else
			p->arr = temp;
	}
	p->arr[p->size++] = x; 
}